package com.mingliqiye.minecraft.enchantment.conflict.forge.network;

import com.mingliqiye.minecraft.enchantment.conflict.common.MinecraftMod;
import com.mingliqiye.minecraft.enchantment.conflict.forge.network.message.ConfigMessage;
import net.minecraft.server.level.ServerPlayer;
import net.minecraftforge.network.Channel;
import net.minecraftforge.network.ChannelBuilder;
import net.minecraftforge.network.SimpleChannel;

public class ChannelHander {

    private static final String PROTOCOL_VERSION = "2.0";
    public static final SimpleChannel CONFIG_CHANNEL_INSTANCE = ChannelBuilder.named(
        "%s:%s".formatted(MinecraftMod.MOD_ID, "config_channel")
    )
        .networkProtocolVersion(1)
        .clientAcceptedVersions(Channel.VersionTest.ACCEPT_MISSING.or(Channel.VersionTest.exact(1)))
        .serverAcceptedVersions(Channel.VersionTest.exact(1))
        .simpleChannel();
    public static final int CONFIG_SYNC = 0;

    public static void sendConfig(ServerPlayer player) {
        ConfigMessage.send(player);
    }

    public static void register() {
        ConfigMessage.register();
    }
}
